<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <div id="app">
        <input v-model="msg">
        <input type="text" v-model='reverseMsg'>
    </div>
    <script type="text/javascript">
        let app = new Vue({
            el: "#app",
            data: {
                msg: "turnip"
            },
            computed: {
                reverseMsg: {
                    get: function() {
                        // split分割成数组,reverse反转,join进行转成字符串
                        return this.msg.split("").reverse().join("");
                    },
                    set: function(value) {
                        console.log(value)
                        this.msg = value.split("").reverse().join("");
                    }
                }
            }
        })
    </script>
</body>

</html>